﻿using System;

namespace Ah.Testudin.Engine.Actors.Spawning
{
    public class ActorBuilderFactory : IActorBuilderFactory
    {
        #region Private Member Variables

        private readonly IActorBuilder _cubeActorBuilder;

        private readonly IActorBuilder _missileActorBuilder;

        private readonly IActorBuilder _explosionActorBuilder;

        #endregion

        #region Constructors

        public ActorBuilderFactory(
            IActorBuilder cubeActorBuilder,
            IActorBuilder missileActorBuilder,
            IActorBuilder explosionActorBuilder)
        {
            _cubeActorBuilder = cubeActorBuilder;

            _missileActorBuilder = missileActorBuilder;

            _explosionActorBuilder = explosionActorBuilder;
        }

        #endregion

        #region IActorBuilderFactory

        public IActorBuilder GetActorBuilder(ActorType actorType)
        {
            switch (actorType)
            {
                case ActorType.Cube:

                    return _cubeActorBuilder;

                case ActorType.Missile:

                    return _missileActorBuilder;

                case ActorType.Explosion:

                    return _explosionActorBuilder;
            }

            throw new ArgumentException("Unexpected actorType");
        }

        #endregion
    }
}
